<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGrCouponsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('gr_coupons', function (Blueprint $table) {
            $table->increments('coupon_id');
            $table->string('coupon_name')->default('')->comment('优惠券名称');
            $table->tinyInteger('coupon_state')->default('0')->comment('使用状态 0：下架 1：上架');
            $table->integer('coupon_min_price')->nullable()->comment('优惠券最低使用价格');
            $table->integer('coupon_price')->comment('优惠价格');
            $table->tinyInteger('coupon_type')->comment('类型  0:满减券 1:立减券');
            $table->tinyInteger('coupon_application')->comment('范围  0:全平台券 1:商家可用 2:商品类型券');
            $table->tinyInteger('coupon_astrict_type')->comment('限制类型：0:互斥券 1:共享券');
            $table->integer('coupon_stock')->comment('商品库存');
            $table->tinyInteger('distribution_method')->comment('发放方式 0：自动发放 1：手动发放');
            $table->tinyInteger('receive_restrict_number')->comment('限制次数');
            $table->dateTime('coupon_start_time')->default('0000-00-00 00:00:00')->comment('开始领取时间');
            $table->dateTime('coupon_exit_time')->default('0000-00-00 00:00:00')->comment('结束领取时间');
            $table->integer('coupon_effective_day')->comment('可使用天数');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('gr_coupons');
    }
}
